package hang.xipujewelWeb.repository.jpa;

import hang.xipujewelWeb.entity.app.ShoppingCart;
import hang.xipujewelWeb.repository.JpaDao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;

public interface ShoppingCartDao extends JpaDao<ShoppingCart> {

	@Query("From  ShoppingCart s where s.uesr.id=?1 and s.jewel.id=?2 and status=0")
	public ShoppingCart findByUesrAndJewel(Long userId, Long jewelId);

	@Query("From  ShoppingCart s where s.uesr.id=?1 and s.ring.id=?2 and status=0")
	public List<ShoppingCart> findByUesrAndRing(Long userId, Long ringId);

	@Query("From  ShoppingCart s where s.uesr.id=?1  and status=0")
	public List<ShoppingCart> findByUesr(Long userId);

	//	@Query("delete  ShoppingCart s where  s.uesr.id=?1 and s.jewel.id=?2")
	//	public void deleteByUserJewel(Long userId, Long jewelId);
	//
	//	@Query("delete  ShoppingCart s where  s.uesr.id=?1 and s.ring.id=?2")
	//	public void deleteByUserRing(Long userId, Long ringId);
}
